var Jsons = [
    {
    "category": "武侠玄幻",
    "list": [
        {
            "works_title": "《九州·缥缈录》",
            "name": "江南",
            "score": "9",
            "publish" : '人民文学出版社',
            "works_pic": ""
        },{
            "works_title": "《散落星河的记忆1：迷失》",
            "name": "桐华",
            "score": "9",
            "publish" : '湖南文艺出版社',
            "works_pic": ""
        },{
            "works_title": "《一瓣河川》",
            "name": "雨楼清歌",
            "score": "6",
            "publish" : '新星出版社',
            "works_pic": ""
        },{
            "works_title": "《择天记》",
            "name": "猫腻",
            "score": "6",
            "publish" : '起点中文网',
            "works_pic": ""
        },{
            "works_title": "《倾国艳伶》",
            "name": "虫不老",
            "score": "6",
            "publish" : '起点中文网',
            "works_pic": ""
        }
    ]
},
    {
    "category": "科幻小说类",
    "list": [
        {
            "works_title": "《孤独深处》",
            "name": "郝景芳",
            "score": "9",
            "publish" : '江苏文艺出版社',
            "works_pic": ""
        },{
            "works_title": "《赡养人类》",
            "name": "刘慈欣",
            "score": "8",
            "publish" : '中国华侨出版社',
            "works_pic": ""
        },{
            "works_title": "《蒲公英王朝：七王之战》",
            "name": "刘宇昆",
            "score": "6",
            "publish" : '江苏凤凰文艺出版社',
            "works_pic": ""
        },{
            "works_title": "《世界的另一面》",
            "name": "宁三意",
            "score": "7",
            "publish" : '现代出版社，成都万有图书有限公司',
            "works_pic": ""
        },{
            "works_title": "《再生砖》",
            "name": "韩松",
            "score": "6",
            "publish" : '上海人民出版社',
            "works_pic": ""
        }

    ]
},
    {
        "category": "侦探悬疑类（含盗墓、犯罪、灵异等题材）",
        "list": [
            {
                "works_title": "《余罪：我的侦探笔记》",
                "name": "常书欣",
                "score": "9",
                "publish" : '海南出版社',
                "works_pic": ""
            },{
                "works_title": "《偷窥者：法医秦明》系列第六季",
                "name": "秦明",
                "score": "9",
                "publish" : '湖南文艺出版社',
                "works_pic": ""
            },{
                "works_title": "《借命而生》",
                "name": "石一枫",
                "score": "9",
                "publish" : '人民文学出版社',
                "works_pic": ""
            },{
                "works_title": "《暗黑者外传:惩罚》",
                "name": "周浩晖",
                "score": "7",
                "publish" : '中国城市出版社',
                "works_pic": ""
            },{
                "works_title": "《长夜难明》",
                "name": "紫金陈",
                "score": "6",
                "publish" : '云南人民出版社',
                "works_pic": ""
            }

        ]
    },
    {
        "category": "爱情都市类（含青春、职场、游戏、竞技等题材）",
        "list": [
            {
                "works_title": "《房思琪的初恋乐园》",
                "name": "林奕含",
                "score": "9",
                "publish" : '磨铁 北京联合出版有限责任公司',
                "works_pic": ""
            },{
                "works_title": "《茧》",
                "name": "张悦然",
                "score": "8",
                "publish" : '人民文学出版社',
                "works_pic": ""
            },{
                "works_title": "《天黑得很慢》",
                "name": "周大新",
                "score": "8",
                "publish" : '人民文学出版社',
                "works_pic": ""
            },{
                "works_title": "《女神一号》",
                "name": "冯唐",
                "score": "7",
                "publish" : '九州出版社',
                "works_pic": ""
            },{
                "works_title": "《慈悲》",
                "name": "路内",
                "score": "6",
                "publish" : '人民文学出版社',
                "works_pic": ""
            }

        ]
    },
    {
        "category": "历史军事类",
        "list": [
            {
                "works_title": "《北鸢》",
                "name": "葛亮",
                "score": "10",
                "publish" : '人民文学出版社',
                "works_pic": ""
            },{
                "works_title": "《清明上河图密码》",
                "name": "冶文彪",
                "score": "7",
                "publish" : '北京联合出版公司',
                "works_pic": ""
            },{
                "works_title": "《长安十二时辰》",
                "name": "马伯庸",
                "score": "8",
                "publish" : '湖南文艺出版社',
                "works_pic": ""
            },{
                "works_title": "《大唐李白·将进酒》",
                "name": "张大春",
                "score": "6",
                "publish" : '广西师范大学出版社',
                "works_pic": ""
            },{
                "works_title": "《大汉光武①少年游》",
                "name": "酒徒",
                "score": "6",
                "publish" : '上海文艺出版社',
                "works_pic": ""
            }

        ]
    }]

$(function () {
    $('.sign-way-open').click(function () {
        $('.sign-way').show();
    })
    $('.sign-way-close').click(function () {
        $('.sign-way').hide();
    })
})

var app = new Vue({
    el: '#body',

    data() {
        return {
            type : $config.GetQueryString('type') || '',
            lists: '',
        }
    },
    created(){
        if(this.type=='new'){
            this.lists = Jsons
        }else{
            this.getLists()
        }
    },
    mounted() {
        DOMINIT();
    },
    methods: {
        getLists (){
            this.common().http(this, {
                url: `/winner/db/2018lyswxj`,
                success(json) {
                    this.lists = json.data;
                }
            })
        }
    }
})

function DOMINIT() {

    // 跳转到指定位置
    function click_scroll(ele) {
        var scroll_offset = $(ele).offset(); //得到pos这个div层的offset，包含两个值，top和left
        $("body,html").animate({
            scrollTop:scroll_offset.top-200 //让body的scrollTop等于pos的top，就实现了滚动
        },300);
    }

    // 导航跳转指定位置
    $('nav .list a , nav .logo').on('click',function () {
        var ele = $(this).data('togo');
        // if(ele) click_scroll(ele);
        if(ele=='body'){
            location.href='index.html';
        }else{
            location.href='index.html?name='+ele;
        }
    })

    //监听导航栏
    function showNav() {
        var top = $(document).scrollTop(),
            ishas = $('nav').hasClass('scroll');
        if(top>0){
            if(!ishas) $('nav').addClass('scroll');
        }else{
            if(ishas) $('nav').removeClass('scroll');
        }
    }
    $(window).scroll(function () {
        showNav();
    })
    showNav();
}